package com.qf.smartplatform.dto;

import com.qf.smartplatform.exceptions.ResultCode;

/**
 * projectName:day12_27_Test
 * author:guoLei
 * time:2021/12/29 19:53
 * description:
 */
public class Result {
    private int code;
    private String msg;
    private Object data;

    public static Result setOK() {
        return setOK(null);
    }

    public static Result setOK(Object data) {
        return setError(ResultCode.SUCCESS, "成功", data);
    }

    public static Result setError(int code, String msg, Object data) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }

    public static Result setError(int code, String message) {
        return setError(code, message, null);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
